const mongoose = require("../conf/db");

const schema = new mongoose.Schema(
  {
    title: {
      type: String,
      required: true
    },

    content: {
      type: String,
      required: true
    },

    user: {
      type: mongoose.SchemaTypes.ObjectId,
      ref: "user"
    },

    pictures: {
      type: [
        {
          type: mongoose.SchemaTypes.ObjectId,
          ref: "file"
        }
      ]
    }
  },
  { timestamps: true }
);

module.exports = mongoose.model("post", schema);
